package cn.com.java.service.impl;


import cn.com.java.mapper.SysUserRoleMapper;
import cn.com.java.model.SysUser;
import cn.com.java.model.SysUserRole;
import cn.com.java.service.SysUserRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements SysUserRoleService {


    @Override
    public void saveBySysUser(SysUser sysUser) {
        SysUserRole sysUserRole = new SysUserRole();
        sysUserRole.setUserId(sysUser.getId());
        sysUserRole.setRoleId(sysUser.getSysRoleId());
        save(sysUserRole);
    }

    @Override
    public void updateBySysUser(SysUser sysUser) {
        SysUserRole sysUserRole = new SysUserRole();
        sysUserRole.setUserId(sysUser.getId());
        sysUserRole.setRoleId(sysUser.getSysRoleId());
        updateById(sysUserRole);
    }
}